const Mock = require('mockjs')

const data = Mock.mock({
  'list|2': [{
    "userId|+1": 1,
    "nickName|+1": ['zhangsan', 'lisi'],
    "phone|+1": ["13818888888", "13678764321"],
    "avatar": "/static/uploadfile/77cfc1dd-535c-4e60-b34a-5909e2cf5ed0.jpg",
    "sex": "0",
    "email": "1@1.com",
    "remark": "",
    "createdAt": "2020-04-11T15:52:48+08:00",
    "status": "0",
    "dataScope": "",
    "username|+1": ["admin", "hello"],
    "password": "$2a$10$fWkAKmNCntimDhPhHoa9luB6qGCQKVi4S73OVJVd1UujiQVK2Q9qy",
    "deptName|+1": ["研发部","采购部"]
  }]
})

module.exports = [
  {
    url: '/api/v1/sysUserList',
    type: 'get',
    response: config => {
      const list = data.list
      return {
        "resultCode": "0000",
        "resultMessage": "success",
        "data": {
          list: list,
          count: 3,
          pageIndex: 1,
          pageSize: 10
        }
      }
    }
  },{
    url: '/api/v1/sysUser/',
    type: 'get',
    response: config => {
      const list = data.list
      return {
        "resultCode": "0000",
        "resultMessage": "success",
        "data": {
          "userId": 1,
          "nickName": "zhangwj",
          "phone": "13818888888",
          "roleId": 1,
          "salt": "",
          "avatar": "/static/uploadfile/77cfc1dd-535c-4e60-b34a-5909e2cf5ed0.jpg",
          "sex": "0",
          "email": "1@1.com",
          "deptId": 7,
          "postId": 2,
          "createBy": "1",
          "updateBy": "1",
          "remark": "",
          "status": "0",
          "dataScope": "",
          "params": "",
          "createdAt": "2019-11-10T14:05:55+08:00",
          "updatedAt": "2020-04-08T14:30:38+08:00",
          "deletedAt": null,
          "username": "admin",
          "password": "",
          "role_name": "系统管理员"
        },
        "postIds": [1],
        "posts": [{
          "postId": 1,
          "postName": "首席执行官",
          "postCode": "CEO",
          "sort": 0,
          "status": "0",
          "remark": "首席执行官",
          "createBy": "1",
          "updateBy": "0001-01-01T00:00:00Z",
          "dataScope": "",
          "params": "",
          "createdAt": "2020-02-27T21:45:58+08:00",
          "updatedAt": "2020-04-08T14:56:28+08:00",
          "deletedAt": null
        }],
        "roleIds": [1],
        "roles": [{
          "roleId": 1,
          "roleName": "系统管理员",
          "status": "0",
          "roleKey": "admin",
          "roleSort": 1,
          "flag": "",
          "createBy": "1",
          "updateBy": "",
          "remark": "",
          "admin": false,
          "dataScope": "3",
          "params": "",
          "menuIds": null,
          "deptIds": null,
          "createdAt": "2020-03-09T21:21:54+08:00",
          "updatedAt": "2020-08-14T22:37:40+08:00",
          "deletedAt": null
        }]
      }
    }
  },{
    url: '/api/v1/sysUser',
    type: 'put',
    response: config => {
      return {
        "resultCode": "0000",
        "resultMessage": "success"
      }
    }
  },{
    url: '/api/v1/sysUser/.*',
    type: 'delete',
    response: config => {
      return {
        "resultCode": "0000",
        "resultMessage": "success"
      }
    }
  },{
    url: '/api/v1/sysUser',
    type: 'post',
    response: config => {
      return {
        "resultCode": "0000",
        "resultMessage": "success"
      }
    }
  }
]